import { ListResponse, PagerQuery } from '.'
import { authorizeRequest } from '../util/http'
import { Picture } from './picture'

const ROUTER = '/v1/favorite/picture'

type GetFavoritePictureListParams = PagerQuery & {
    favoriteId: number
}
export type PictureListResponse = ListResponse<Picture>
export const apiGetFavoritePictureList = async (params: GetFavoritePictureListParams) => {
    return (await authorizeRequest.get<PictureListResponse>(ROUTER, { params })).data
}

export interface CreateFavoritePictureRequest {
    favoriteId: number
    pictureId: number
}

export const apiPostFavoritePicture = async (params: CreateFavoritePictureRequest) => {
    return (await authorizeRequest.post<object>(ROUTER, params)).data
}